Compressing textures

In Kanzi, you can use the ASTC, ATC, ETC, and PVRTC algorithms for compressing textures, as well as precompressed DXT textures.

If your application tries to read more data from the memory than the memory can handle, reading the memory becomes a performance bottleneck for your application. If your target hardware supports any of these compression methods, use texture compression to reduce the memory bandwidth and improve the performance of your application. You can achieve the relatively smallest file size and the best image quality with the modern ASTC algorithm.

The best performing compression level depends on your target device. High compression levels use more CPU but less memory bandwidth, whereas low compression levels use less CPU but more memory bandwidth.

Kanzi applications send compressed textures directly to the GPU, reducing the amount of interchanged data and without requiring preprocessing on the CPU side at runtime (for example, loading libJPEG or libPNG).

For example, an unpacked 256 by 256 pixel RGB texture uses 196 kb (256 * 256 * 3 bytes). When compressed:

If your target hardware does not support any of these compression algorithms, in some cases raw image format can be faster than any compression algorithm. This is particularly true when processing single small images.

If your target hardware does not support the selected texture compression algorithm, when you run your Kanzi application on your target device, Kanzi prints a warning message to the log. Kanzi paints black the surfaces where you use compressed texture formats that your target hardware does not support.

Because OpenGL expects DXT texture data to have the bottom row first, compress DXT files vertically flipped. Note that you can use the DXT files in your Kanzi application, but the DXT files are not supported in the Win32 emulation because of GPU limitations. See Importing images.

Kanzi Studio compresses the images when you create the kzb file, but you can also compress them manually. See Preprocessing images manually.

TIP

When Kanzi Studio compresses images it by default uses all available CPU resources of your computer. To free up CPU resources for other applications while Kanzi Studio compresses multiple images, select Edit > User Preferences and in the Advanced tab adjust the value of the Images to compress in parallel setting.
The Images to compress in parallel setting limits the number of logical cores Kanzi Studio uses when preprocessing multiple images. The number of logical cores in your computer determines the Maximum value.

Using the ASTC algorithm

If your target hardware supports ASTC algorithm, use the ASTC algorithm for the best results. The ASTC algorithm creates smaller files and results in better image quality than the older ATC, ETC, and PVRTC algorithms.

To use the ASTC algorithm:

  1. In Kanzi Studio in the Library select Resource Files > Images, and select the image for which you want to apply compression.
  2. In the Properties set the Target Format property to ASTC.
  3. In the Properties set:

Using the ATC algorithm

To use the ATC algorithm:

  1. In Kanzi Studio in the Library select Resource Files > Images, and select the image for which you want to apply compression.
  2. In the Properties set the Target Format property to ATC.
  3. Set the ATC Compression Scheme property to:

Using the ETC algorithm

To use the ETC algorithm:

  1. In Kanzi Studio in the Library select Resource Files > Images, and select the image for which you want to apply compression.
  2. In the Properties set the Target Format property to the ETC compression you want to use:

Using the PVRTC algorithm

The PVRTC algorithm works best for photorealistic textures. Kanzi supports the PVRTC compression according to the PVRTC1 and PVRTC2 schemes. PVRTC2 has higher quality than PVRTC1, especially with textures requiring sharp alpha transitions, but it is not supported by all PowerVR hardware. Additionally, only Imagination Technologies hardware, or a desktop platform using a development emulator support PVRTC compression.

NOTE

When using the PVRTC algorithm to compress textures, to get correct results, the textures must be square and the power of two in size.

To use the PVRTC algorithm:

  1. In Kanzi Studio in the Library select Resource Files > Images, and select the image for which you want to apply compression.
  2. In the Properties set the Target Format property to PVRTC.
  3. In the Properties set:

Preprocessing images manually

Kanzi Studio compresses the images when you create the kzb file, but you can also compress them manually. To manually preprocess images, in the Library > Resource Files > Images right-click one or more images you want to preprocess, and select Preprocess images.

TIP

When Kanzi Studio compresses images it by default uses all available CPU resources of your computer. To free up CPU resources for other applications while Kanzi Studio compresses multiple images, select Edit > User Preferences and in the Advanced tab adjust the value of the Images to compress in parallel setting.
The Images to compress in parallel setting limits the number of logical cores Kanzi Studio uses when preprocessing multiple images. The number of logical cores in your computer determines the Maximum value.

See also

Adjusting the data size

Loading resources in parallel

Using mipmaps

Filtering textures

Troubleshooting the performance of your application

Images and textures best practices

Best practices

Images

Configuring Kanzi Studio projects